const md5 = require('blueimp-md5')
const jwt = require('jsonwebtoken')
const { jwtSecretKey } = require('../config/jwtSecretKey')
const sha1 = require('sha1')


class SecretTool {
  static md5(query){
    return md5(query)
  }
  // jwt生成token
  static jwtSign(query,time){
    return jwt.sign(query,jwtSecretKey,{expiresIn: time})
  }
  // jwt token解密
  static jwtVerify(query){
    return jwt.sign(query,jwtSecretKey)
  }
  // sha1微信加密
  static sha1(data){
    return sha1(data)
  }
}

module.exports = SecretTool